--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/04_Descriptives_log.txt
  log type:  text
 opened on:  25 Jun 2026, 12:49:15
r; t=0.00 12:49:15

. 
. include "_OutcomeLabels.do"

. /*==============================================================================
>   _OutcomeLabels.do  (helper, not run on its own)
> 
>   Defines polished, publication-ready labels for every outcome that appears
>   in figures and tables. Labels use the macro pattern `lbl_<outcome>`.
>   Visualization do files `include` this file and reference `lbl_<outcome>`
>   to print a pretty label rather than the raw Stata variable name.
> 
>   Categorical/binary indicators are suffixed with "[=1]" so the reader sees
>   what a unit change means; counts and continuous variables get explicit
>   units; standardized indices are flagged "(SD)".
> 
>   Sandra Rozo
> ==============================================================================*/
. 
. * ---- Economic well-being -----------------------------------------------------
. local lbl_jeea_index_wellbeing  "Well-being index (SD)"
r; t=0.00 12:49:15

. local lbl_labour_income         "Log monthly labor income"
r; t=0.00 12:49:15

. local lbl_gasto_capita          "Log per-capita HH consumption"
r; t=0.00 12:49:15

. local lbl_income_maxhh          "Log HH-max labor income"
r; t=0.00 12:49:15

. local lbl_employed              "Employed [=1]"
r; t=0.00 12:49:15

. 
. * ---- Labor ------------------------------------------------------------------
. local lbl_jeea_index_labor      "Labor index (SD)"
r; t=0.00 12:49:15

. local lbl_formal                "Formal employment [=1]"
r; t=0.00 12:49:15

. local lbl_hora_semana           "Log weekly hours (salaried)"
r; t=0.00 12:49:15

. 
. * ---- Services and rights ----------------------------------------------------
. local lbl_jeea_index_services   "Services index (SD)"
r; t=0.00 12:49:15

. local lbl_sisben                "SISBEN registration [=1]"
r; t=0.00 12:49:15

. local lbl_subs                  "Subsidized health [=1]"
r; t=0.00 12:49:15

. local lbl_bank                  "Savings account [=1]"
r; t=0.00 12:49:15

. local lbl_has_bank_account      "Bank account (incl. savings) [=1]"
r; t=0.00 12:49:15

. local lbl_govtr                 "Govt. transfers [=1]"
r; t=0.00 12:49:15

. 
. * ---- Health -----------------------------------------------------------------
. local lbl_health_pca            "Health PCA index (SD)"
r; t=0.00 12:49:15

. local lbl_anx_depr              "Severe anxiety/depression [=1]"
r; t=0.00 12:49:15

. local lbl_any_anx_depr          "Any anxiety/depression [=1]"
r; t=0.00 12:49:15

. local lbl_vas_score             "Self-rated health (0-100)"
r; t=0.00 12:49:15

. local lbl_phys_problem          "Physical health problem [=1]"
r; t=0.00 12:49:15

. local lbl_chronic_illness       "Chronic illness [=1]"
r; t=0.00 12:49:15

. local lbl_mh_index              "Mental-health composite (SD)"
r; t=0.00 12:49:15

. local lbl_life_satisfaction     "Life satisfaction (0-10)"
r; t=0.00 12:49:15

. local lbl_hi5_inv               "EQ-5D anx/depr (5-low to 1-high)"
r; t=0.00 12:49:15

. 
. * ---- Food security ----------------------------------------------------------
. local lbl_index_food            "Food security index (SD)"
r; t=0.00 12:49:15

. local lbl_skip_meals            "Skipped meals last month [=1]"
r; t=0.00 12:49:15

. local lbl_went_without_food     "Went without food [=1]"
r; t=0.00 12:49:15

. local lbl_protein_days          "Days w/ protein (last week)"
r; t=0.00 12:49:15

. local lbl_food_insecure_seek    "Sought food assistance [=1]"
r; t=0.00 12:49:15

. 
. * ---- Housing ----------------------------------------------------------------
. local lbl_index_housing         "Housing quality index (SD)"
r; t=0.00 12:49:15

. local lbl_adequate_housing      "Adequate housing [=1]"
r; t=0.00 12:49:15

. local lbl_has_electricity       "Has electricity [=1]"
r; t=0.00 12:49:15

. local lbl_has_water             "Has running water [=1]"
r; t=0.00 12:49:15

. local lbl_has_sewage            "Has sewage [=1]"
r; t=0.00 12:49:15

. 
. * ---- Integration ------------------------------------------------------------
. local lbl_index_integration     "Integration index (SD)"
r; t=0.00 12:49:15

. local lbl_belonging             "Sense of belonging (1-4)"
r; t=0.00 12:49:15

. local lbl_feel_integrated       "Feels integrated (1-4)"
r; t=0.00 12:49:15

. local lbl_trust_col             "Trust in Colombians (out-group, 1-5)"
r; t=0.00 12:49:15

. local lbl_trust_ven             "Trust in Venezuelans (in-group, 1-5)"
r; t=0.00 12:49:15

. local lbl_general_trust         "General trust in people (1-5)"
r; t=0.00 12:49:15

. local lbl_venezuelans_help_me   "Venezuelans help me (1-5)"
r; t=0.00 12:49:15

. local lbl_trust_index           "Prosocial behaviors composite (SD)"
r; t=0.00 12:49:15

. local lbl_col_friends           "Number Colombian friends"
r; t=0.00 12:49:15

. local lbl_community_org         "Belongs to community org [=1]"
r; t=0.00 12:49:15

. local lbl_connection_colombia   "Strong connection to Colombia [=1]"
r; t=0.00 12:49:15

. local lbl_colombians_help_me    "Colombians help me (1-5)"
r; t=0.00 12:49:15

. local lbl_count_on_col          "Can count on Colombians (1-5)"
r; t=0.00 12:49:15

. 
. * ---- Discrimination ---------------------------------------------------------
. local lbl_index_discrim         "Discrimination index (SD)"
r; t=0.00 12:49:15

. local lbl_discrim_ever          "Ever discriminated against [=1]"
r; t=0.00 12:49:15

. local lbl_discrim_freq          "Discrimination frequency (1-5)"
r; t=0.00 12:49:15

. local lbl_filed_complaint       "Filed discrimination complaint [=1]"
r; t=0.00 12:49:15

. 
. * ---- Migration intentions ---------------------------------------------------
. local lbl_intend_stay           "Intends to stay in Colombia [=1]"
r; t=0.00 12:49:15

. local lbl_plan_stay_5yr         "Plans to stay 5+ years [=1]"
r; t=0.00 12:49:15

. local lbl_considered_return_ven "Considered returning to Venezuela [=1]"
r; t=0.00 12:49:15

. 
. * ---- COVID -----------------------------------------------------------------
. local lbl_index_covid           "COVID resilience index (SD)"
r; t=0.00 12:49:15

. local lbl_covid_income_down     "Income fell during COVID [=1]"
r; t=0.00 12:49:15

. local lbl_covid_eviction        "Faced eviction during COVID [=1]"
r; t=0.00 12:49:15

. local lbl_covid_received_aid    "Received COVID aid [=1]"
r; t=0.00 12:49:15

. 
. * ---- Education -------------------------------------------------------------
. local lbl_currently_studying    "Currently studying [=1]"
r; t=0.00 12:49:15

. local lbl_currently_enrolled    "Currently enrolled in school [=1]"
r; t=0.00 12:49:15

. local lbl_degree_validated      "Foreign degree validated [=1]"
r; t=0.00 12:49:15

. 
. * ---- Children --------------------------------------------------------------
. local lbl_child_skip_meals      "Child skipped meals [=1]"
r; t=0.00 12:49:15

. local lbl_child_vaccinated      "Child vaccinated [=1]"
r; t=0.00 12:49:15

. local lbl_child_worked          "Child worked [=1]"
r; t=0.00 12:49:15

. 
. * ---- Remittances -----------------------------------------------------------
. local lbl_index_remit           "Remittances index (SD)"
r; t=0.00 12:49:15

. local lbl_remit_now             "Sends remittances now [=1]"
r; t=0.00 12:49:15

. local lbl_remit_to_parents      "Remits to parents [=1]"
r; t=0.00 12:49:15

. 
. * ---- Financial access and digital ------------------------------------------
. local lbl_index_fin_access      "Financial access index (SD)"
r; t=0.00 12:49:15

. local lbl_index_digital         "Digital access index (SD)"
r; t=0.00 12:49:15

. local lbl_has_savings_account   "Has savings account [=1]"
r; t=0.00 12:49:15

. local lbl_has_mobile_money      "Has mobile money [=1]"
r; t=0.00 12:49:15

. local lbl_has_smartphone        "Has smartphone [=1]"
r; t=0.00 12:49:15

. local lbl_has_internet          "Has internet [=1]"
r; t=0.00 12:49:15

. local lbl_apps_whatsapp         "Uses WhatsApp [=1]"
r; t=0.00 12:49:15

. 
. * ============================================================================
. *  PREDETERMINED COVARIATES (used for balance tests and as RD controls)
. * ============================================================================
. 
. * ---- Demographics ----------------------------------------------------------
. local lbl_female                "Female [=1]"
r; t=0.00 12:49:15

. local lbl_age_panel             "Age (years)"
r; t=0.00 12:49:15

. local lbl_yrseduc               "Years of education"
r; t=0.00 12:49:15

. local lbl_time_col              "Years in Colombia"
r; t=0.00 12:49:15

. local lbl_child_venez           "Has child born in Venezuela [=1]"
r; t=0.00 12:49:15

. 
. * ---- Pre-migration economic conditions (in Venezuela) ----------------------
. local lbl_jobopp                "Had a job offer in Colombia [=1]"
r; t=0.00 12:49:15

. local lbl_labven                "Worked in Venezuela [=1]"
r; t=0.00 12:49:15

. local lbl_typeworkven1          "Worked in agric./manual (VZ) [=1]"
r; t=0.00 12:49:15

. local lbl_typeworkven2          "Worked in services (VZ) [=1]"
r; t=0.00 12:49:15

. local lbl_typeworkven3          "Worked in skilled occ. (VZ) [=1]"
r; t=0.00 12:49:15

. local lbl_written_cont          "Had written contract (VZ) [=1]"
r; t=0.00 12:49:15

. local lbl_average               "Avg. days worked / week (VZ)"
r; t=0.00 12:49:15

. local lbl_smartven              "Owned smartphone in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_owner                 "Homeowner in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_electven              "Had electricity in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_waterven              "Had running water in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_sewageven             "Had sewage in VZ [=1]"
r; t=0.00 12:49:15

. 
. * ---- Family / migration network -------------------------------------------
. local lbl_hhven_parents         "Parents born in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_hhven_spouse          "Spouse born in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_hhven_other           "Other HH members born in VZ [=1]"
r; t=0.00 12:49:15

. local lbl_healthmig             "Healthy at migration [=1]"
r; t=0.00 12:49:15

. local lbl_frdfam                "Network in Colombia [=1]"
r; t=0.00 12:49:15

. r; t=0.01 12:49:15

. 
. di "=================================================================="
==================================================================
r; t=0.00 12:49:15

. di "  04_Descriptives.do"
  04_Descriptives.do
r; t=0.00 12:49:15

. di "  Date: $S_DATE  Time: $S_TIME"
  Date: 25 Jun 2026  Time: 12:49:15
r; t=0.00 12:49:15

. di "=================================================================="
==================================================================
r; t=0.00 12:49:15

. 
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style + extended outcome indices))
r; t=0.11 12:49:15

. 
. /*==============================================================================
>   GROUP & TITLE DEFINITIONS  (mirrors 03 inventory)
> ==============================================================================*/
. 
. local A     jeea_index_wellbeing index_wellbeing gasto_capita ///
>             labour_income income_maxhh employed
r; t=0.00 12:49:15

. local B     jeea_index_labor index_labor formal hora_semana ///
>             has_written_contract underemployed job_tenure ///
>             independent
r; t=0.00 12:49:15

. local C     jeea_index_services index_services sisben subs bank govtr ///
>             transfer_fa transfer_ja transfer_is transfer_bs aid_ngo_church
r; t=0.00 12:49:15

. local D     index_health health_pca vas_score anx_depr any_anx_depr ///
>             phys_problem chronic_illness got_healthcare paid_health ///
>             barrier_no_insurance
r; t=0.00 12:49:15

. local E     index_food skip_meals skip_meals_freq protein_days ///
>             went_without_food food_insecure_seek child_skip_meals
r; t=0.00 12:49:15

. local F     index_housing adequate_housing precarious_housing has_electricity ///
>             has_water has_sewage potable_water n_rooms n_bedrooms ///
>             persons_per_bedroom
r; t=0.00 12:49:15

. local G     index_integration belonging feel_integrated trust_local_govt ///
>             trust_national_govt general_trust col_friends community_org ///
>             connection_colombia feels_foreign meals_with_colombians ///
>             colombian_contacts
r; t=0.00 12:49:15

. local G2    trust_col colombians_help_me count_on_col trust_ven ///
>             venezuelans_help_me count_on_ven
r; t=0.00 12:49:15

. local H     index_discrim discrim_ever discrim_nationality discrim_skin ///
>             discrim_appearance discrim_accent discrim_economic ///
>             discrim_gender discrim_political discrim_freq filed_complaint ///
>             difficulty_legal_help difficulty_find_job
r; t=0.00 12:49:15

. local H2    perc_low_wages perc_no_rights perc_no_docs perc_employers_abuse ///
>             perc_no_other_option perc_prefer_informal perc_fear_deport ///
>             perc_labor_discrim
r; t=0.00 12:49:15

. local I     intend_stay intend_return intend_other plan_stay_5yr ///
>             expect_stay_5yr considered_return_ven wants_reunify
r; t=0.00 12:49:15

. local J     index_covid covid_income_down covid_income_same covid_return_ven ///
>             covid_eviction covid_moved covid_received_aid covid_discrimination ///
>             covid_borrowed_money covid_sold_assets covid_begged
r; t=0.00 12:49:15

. local K     currently_studying currently_enrolled current_enroll_level ///
>             degree_validated literate covid_study_interrupted ///
>             lost_job_no_homologation worked_without_title
r; t=0.00 12:49:15

. local L     child_worked child_hours child_skip_meals child_vaccinated ///
>             covid_study_interrupted currently_enrolled current_enroll_level ///
>             current_grade
r; t=0.00 12:49:15

. local M     index_remit remit_precovid remit_now remit_amount_precovid ///
>             remit_amount_lastmonth remit_to_parents remit_to_siblings ///
>             remit_to_children remit_to_spouse
r; t=0.00 12:49:15

. local N     index_fin_access index_digital bank has_savings_account ///
>             has_mobile_money savings_precovid has_smartphone has_internet ///
>             has_data_plan internet_at_home apps_whatsapp apps_facebook ///
>             apps_email internet_in_vz
r; t=0.00 12:49:15

. 
. local groups A B C D E F G G2 H H2 I J K L M N
r; t=0.00 12:49:15

. local title_A   "Economic well-being"
r; t=0.00 12:49:15

. local title_B   "Labor market"
r; t=0.00 12:49:15

. local title_C   "Services and rights"
r; t=0.00 12:49:15

. local title_D   "Health"
r; t=0.00 12:49:15

. local title_E   "Food security"
r; t=0.00 12:49:15

. local title_F   "Housing"
r; t=0.00 12:49:15

. local title_G   "Social integration and trust"
r; t=0.00 12:49:15

. local title_G2  "Perceived prosociality (sub-group of G)"
r; t=0.00 12:49:15

. local title_H   "Discrimination"
r; t=0.00 12:49:15

. local title_H2  "Perceived labor barriers (sub-group of H)"
r; t=0.00 12:49:15

. local title_I   "Migration intentions"
r; t=0.00 12:49:15

. local title_J   "COVID impacts"
r; t=0.00 12:49:15

. local title_K   "Education (adult)"
r; t=0.00 12:49:15

. local title_L   "Child outcomes"
r; t=0.00 12:49:15

. local title_M   "Remittances"
r; t=0.00 12:49:15

. local title_N   "Financial access and digital"
r; t=0.00 12:49:15

. 
. * Predetermined controls (Layer 4 — should be stable across waves)
. local predet_ctrls female age_panel yrseduc time_col jobopp labven ///
>                    typeworkven1 typeworkven2 typeworkven3 written_cont ///
>                    smartven owner electven waterven sewageven ///
>                    hhven_spouse hhven_other healthmig frdfam ///
>                    child_venez
r; t=0.00 12:49:15

. 
. /*==============================================================================
>   HELPER — classify variable type by inspecting values
> ==============================================================================*/
. 
. * Returns:
. *   r(vtype) = "binary" / "likert" / "ordinal" / "index" / "continuous" / "string"
. *   r(vmin) / r(vmax) / r(vsd) / r(vn)
. capture program drop _classify
r; t=0.00 12:49:15

. program define _classify, rclass
  1.     args var
  2.     capture confirm numeric variable `var'
  3.     if _rc {
  4.         return local vtype "string"
  5.         exit
  6.     }
  7.     qui sum `var'
  8.     return scalar vn   = r(N)
  9.     return scalar vsd  = cond(missing(r(sd)), 0, r(sd))
 10.     if r(N) == 0 {
 11.         return local vtype "empty"
 12.         return scalar vmin = .
 13.         return scalar vmax = .
 14.         exit
 15.     }
 16.     return scalar vmin = r(min)
 17.     return scalar vmax = r(max)
 18.     local mn = r(min)
 19.     local mx = r(max)
 20.     local sd = r(sd)
 21.     qui inspect `var'
 22.     local nuniq = r(N_unique)
 23.     if `nuniq' <= 2 & `mn' >= 0 & `mx' <= 1 {
 24.         return local vtype "binary"
 25.     }
 26.     else if `nuniq' <= 5 & `mn' >= 1 & `mx' <= 5 {
 27.         return local vtype "likert"
 28.     }
 29.     else if `nuniq' <= 12 & `mn' >= 0 & `mx' <= 14 {
 30.         return local vtype "ordinal"
 31.     }
 32.     else if abs(`sd' - 1) < 0.1 & abs((`mx' + `mn')/2) < 1 {
 33.         return local vtype "index"
 34.     }
 35.     else {
 36.         return local vtype "continuous"
 37.     }
 38. end
r; t=0.00 12:49:15

. 
. /*==============================================================================
>   LAYER 1-2-3 PASS — write per-variable summary + flags to a text log
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:49:15

. di "--- Layer 1-3: per-variable summary + flag log ---"
--- Layer 1-3: per-variable summary + flag log ---
r; t=0.00 12:49:15

. 
. file open flog using "$out/04_Descriptives_FlagLog.txt", write replace text
(file ../outputs/04_Descriptives_FlagLog.txt not found)
r; t=0.00 12:49:15

. file write flog "group" _tab "variable" _tab "type" _tab ///
>     "n_w1" _tab "n_w2" _tab "mean_w1" _tab "mean_w2" _tab ///
>     "sd_w1" _tab "sd_w2" _tab "min" _tab "max" _tab "flags" _newline
r; t=0.00 12:49:15

. 
. * All per-outcome stats are written to the flag-log file. We re-read it as
. * a dataset for the per-group PDF tables (avoids the preserve/restore +
. * tempfile-grow pattern, which hit "expression too long" with 148 outcomes).
. 
. local n_present = 0
r; t=0.00 12:49:15

. local n_absent  = 0
r; t=0.00 12:49:15

. local n_empty   = 0
r; t=0.00 12:49:15

. local n_flagged = 0
r; t=0.00 12:49:15

. 
. * Flatten to a single (group, variable) list to avoid 3-level macro nesting
. * (Stata's parser hit "expression too long" with nested foreach loops).
. local flat_groups ""
r; t=0.00 12:49:15

. local flat_vars   ""
r; t=0.00 12:49:15

. foreach g of local groups {
  2.     local vars : copy local `g'
  3.     foreach v of local vars {
  4.         local flat_groups "`flat_groups' `g'"
  5.         local flat_vars   "`flat_vars' `v'"
  6.     }
  7. }
r; t=0.00 12:49:15

. local n_flat : word count `flat_vars'
r; t=0.00 12:49:15

. di "  Total outcomes to summarize: `n_flat'"
  Total outcomes to summarize: 148
r; t=0.00 12:49:15

. 
. * Per-outcome work as a program — gives each call a fresh parser scope so
. * we don't hit "expression too long" on the 148-iteration outer loop.
. capture program drop _summarize_one
r; t=0.00 12:49:15

. program define _summarize_one, rclass
  1.     args g v
  2.     local fl ""
  3. 
.     capture confirm variable `v'
  4.     if _rc {
  5.         file write flog "`g'" _tab "`v'" _tab "ABSENT" _tab "" _tab "" _tab
  6.         file write flog "" _tab "" _tab "" _tab "" _tab "" _tab "" _tab "absent" _newline
  7.         return scalar status = 1   // absent
  8.         exit
  9.     }
 10. 
.     _classify `v'
 11.     local vtype = "`r(vtype)'"
 12.     local vmin  = r(vmin)
 13.     local vmax  = r(vmax)
 14. 
.     if "`vtype'" == "string" | "`vtype'" == "empty" {
 15.         file write flog "`g'" _tab "`v'" _tab "`vtype'" _tab "0" _tab "0" _tab
 16.         file write flog "" _tab "" _tab "" _tab "" _tab "" _tab "" _tab "skip" _newline
 17.         return scalar status = 2   // empty
 18.         exit
 19.     }
 20. 
.     qui count if `v' != . & wave_num == 1
 21.     local n1 = r(N)
 22.     qui sum `v' if wave_num == 1
 23.     local m1 = r(mean)
 24.     local s1 = cond(missing(r(sd)), 0, r(sd))
 25.     qui count if `v' != . & wave_num == 2
 26.     local n2 = r(N)
 27.     qui sum `v' if wave_num == 2
 28.     local m2 = r(mean)
 29.     local s2 = cond(missing(r(sd)), 0, r(sd))
 30. 
.     if "`vtype'" == "binary" {
 31.         qui count if `v' != . & !inlist(`v', 0, 1)
 32.         if r(N) > 0 local fl "`fl' bin_outofrange(`r(N)')"
 33.     }
 34.     else if "`vtype'" == "likert" {
 35.         qui count if `v' != . & !inrange(`v', 1, 5)
 36.         if r(N) > 0 local fl "`fl' likert_outofrange(`r(N)')"
 37.     }
 38.     else if "`vtype'" == "index" {
 39.         if abs(`m1') > 0.5 & `n1' > 100 local fl "`fl' index_w1_offcenter"
 40.         if abs(`m2') > 0.5 & `n2' > 100 local fl "`fl' index_w2_offcenter"
 41.     }
 42.     if `n1' < 100 & `n2' < 100 local fl "`fl' very_low_N"
 43. 
.     local m1s = string(`m1', "%9.3f")
 44.     local m2s = string(`m2', "%9.3f")
 45.     local s1s = string(`s1', "%9.3f")
 46.     local s2s = string(`s2', "%9.3f")
 47.     local mns = string(`vmin', "%9.3f")
 48.     local mxs = string(`vmax', "%9.3f")
 49.     file write flog "`g'" _tab "`v'" _tab "`vtype'" _tab "`n1'" _tab "`n2'" _tab
 50.     file write flog "`m1s'" _tab "`m2s'" _tab "`s1s'" _tab "`s2s'" _tab
 51.     file write flog "`mns'" _tab "`mxs'" _tab "`fl'" _newline
 52.     return scalar status = cond("`fl'" == "", 0, 3)   // 0=ok, 3=flagged
 53. end
r; t=0.00 12:49:15

. 
. forvalues k = 1/`n_flat' {
  2.     local g : word `k' of `flat_groups'
  3.     local v : word `k' of `flat_vars'
  4.     _summarize_one `g' `v'
  5.     local st = r(status)
  6.     if `st' == 0 local ++n_present
  7.     else if `st' == 1 local ++n_absent
  8.     else if `st' == 2 local ++n_empty
  9.     else if `st' == 3 {
 10.         local ++n_present
 11.         local ++n_flagged
 12.     }
 13. }
r; t=1.56 12:49:16

. file close flog
r; t=0.00 12:49:16

. 
. di "  Outcomes summarized: `n_present'  absent: `n_absent'  string/empty: `n_empty'"
  Outcomes summarized: 147  absent: 0  string/empty: 1
r; t=0.00 12:49:16

. di "  Flagged for review:  `n_flagged'"
  Flagged for review:  1
r; t=0.00 12:49:16

. 
. /*==============================================================================
>   LAYER 3 — TARGETED INTERNAL-CONSISTENCY CHECKS
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:49:16

. di "--- Layer 3: targeted consistency checks ---"
--- Layer 3: targeted consistency checks ---
r; t=0.00 12:49:16

. 
. local ic_names ""
r; t=0.00 12:49:16

. local ic_values ""
r; t=0.00 12:49:16

. 
. * discrim_ever should equal max of the dimension dummies
. capture {
r; t=0.02 12:49:17

. 
. * intend_stay + intend_return + intend_other should sum to 1
. capture {
r; t=0.01 12:49:17

. 
. * subs and contrib_health mutually exclusive
. capture {
r; t=0.00 12:49:17

. 
. * formal = employed & has_contract & pension
. capture {
r; t=0.00 12:49:17

. 
. * hora_semana should equal log(hours_raw + 1) up to floating point
. capture {
r; t=0.00 12:49:17

. 
. * gasto_capita = log(gasto_capita_raw + 1)
. capture {
r; t=0.00 12:49:17

. 
. * labour_income = log(labour_income_raw / 1e6 + 1)
. capture {
r; t=0.00 12:49:17

. 
. /*==============================================================================
>   LAYER 4 — CROSS-WAVE CONSISTENCY OF PREDETERMINED CONTROLS
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:49:17

. di "--- Layer 4: predetermined controls across waves ---"
--- Layer 4: predetermined controls across waves ---
r; t=0.00 12:49:17

. tempname X
r; t=0.00 12:49:17

. matrix `X' = J(1, 4, .)
r; t=0.00 12:49:17

. local pre_names ""
r; t=0.00 12:49:17

. 
. foreach v of local predet_ctrls {
  2.     capture confirm variable `v'
  3.     if _rc continue
  4.     qui sum `v' if wave_num == 1
  5.     local m1 = r(mean)
  6.     local s1 = cond(missing(r(sd)), 0, r(sd))
  7.     qui sum `v' if wave_num == 2
  8.     local m2 = r(mean)
  9.     local s2 = cond(missing(r(sd)), 0, r(sd))
 10. 
.     * Standardized difference
.     local pooled_sd = cond(`s1' + `s2' > 0, sqrt((`s1'^2 + `s2'^2)/2), 1)
 11.     local std_diff = abs(`m1' - `m2') / `pooled_sd'
 12. 
.     matrix `X' = (`X' \ (`m1', `m2', `m2' - `m1', `std_diff'))
 13.     local pre_names "`pre_names' `v'"
 14.     di %-20s "`v'" "  W1=" %7.3f `m1' "  W2=" %7.3f `m2' "  std diff=" %5.3f `std_diff'
 15. }
female                W1=  0.531  W2=  0.529  std diff=0.003
age_panel             W1= 23.565  W2= 24.477  std diff=0.055
yrseduc               W1= 13.161  W2= 13.237  std diff=0.027
time_col              W1= 48.657  W2= 48.965  std diff=0.023
jobopp                W1=  0.356  W2=  0.372  std diff=0.033
labven                W1=  0.981  W2=  0.984  std diff=0.027
typeworkven1          W1=  0.587  W2=  0.582  std diff=0.010
typeworkven2          W1=  0.151  W2=  0.157  std diff=0.018
typeworkven3          W1=  0.173  W2=  0.182  std diff=0.022
written_cont          W1=  0.451  W2=  0.454  std diff=0.007
smartven              W1=  0.557  W2=  0.565  std diff=0.016
owner                 W1=  0.864  W2=  0.867  std diff=0.007
electven              W1=  0.995  W2=  0.995  std diff=0.000
waterven              W1=  0.863  W2=  0.853  std diff=0.028
sewageven             W1=  0.932  W2=  0.930  std diff=0.007
hhven_spouse          W1=  0.610  W2=  0.620  std diff=0.021
hhven_other           W1=  0.097  W2=  0.094  std diff=0.012
healthmig             W1=  0.102  W2=  0.100  std diff=0.009
frdfam                W1=  0.723  W2=  0.731  std diff=0.017
child_venez           W1=  1.824  W2=  1.845  std diff=0.014
r; t=0.12 12:49:17

. * Drop seed row
. matrix `X' = `X'[2..., 1...]
r; t=0.00 12:49:17

. 
. /*==============================================================================
>   LAYER 5 — TREATMENT DIFFERENCES (mean by pep / trt_hh) for headline outcomes
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:49:17

. di "--- Layer 5: treatment differences for headline outcomes ---"
--- Layer 5: treatment differences for headline outcomes ---
r; t=0.00 12:49:17

. 
. local headline jeea_index_wellbeing gasto_capita labour_income employed ///
>                jeea_index_labor formal hora_semana ///
>                jeea_index_services sisben subs bank govtr ///
>                health_pca anx_depr ///
>                index_food index_housing index_integration index_covid ///
>                index_remit index_fin_access index_digital index_discrim
r; t=0.00 12:49:17

. 
. tempname TD
r; t=0.00 12:49:17

. matrix `TD' = J(1, 4, .)
r; t=0.00 12:49:17

. local td_names ""
r; t=0.00 12:49:17

. 
. foreach v of local headline {
  2.     capture confirm variable `v'
  3.     if _rc continue
  4. 
.     * Choose treatment based on outcome (HH-level vs individual)
.     local treat pep
  5.     if inlist("`v'", "gasto_capita", "income_maxhh", "bank", "govtr", ///
>                      "index_remit", "remit_now") {
  6.         local treat trt_hh
  7.     }
  8. 
.     qui sum `v' if `treat' == 0 & wave_num == 1
  9.     local c1 = r(mean)
 10.     qui sum `v' if `treat' == 1 & wave_num == 1
 11.     local t1 = r(mean)
 12.     qui sum `v' if `treat' == 0 & wave_num == 2
 13.     local c2 = r(mean)
 14.     qui sum `v' if `treat' == 1 & wave_num == 2
 15.     local t2 = r(mean)
 16. 
.     matrix `TD' = (`TD' \ (`c1', `t1' - `c1', `c2', `t2' - `c2'))
 17.     local td_names "`td_names' `v'"
 18.     di %-30s "`v'(`treat')" "  W1: ctrl=" %6.3f `c1' " (T-C)=" %6.3f (`t1' - `c1') ///
>         "  W2: ctrl=" %6.3f `c2' " (T-C)=" %6.3f (`t2' - `c2')
 19. }
jeea_index_wellbeing(pep)       W1: ctrl=-0.095 (T-C)= 0.487  W2: ctrl=-0.103 (T-C)= 0.363
gasto_capita(trt_hh)            W1: ctrl= 1.295 (T-C)= 0.192  W2: ctrl= 1.350 (T-C)= 0.131
labour_income(pep)              W1: ctrl= 0.098 (T-C)= 0.157  W2: ctrl= 0.120 (T-C)= 0.153
employed(pep)                   W1: ctrl= 0.581 (T-C)= 0.076  W2: ctrl= 0.630 (T-C)= 0.047
jeea_index_labor(pep)           W1: ctrl=-0.000 (T-C)= 2.041  W2: ctrl=-0.003 (T-C)= 0.587
formal(pep)                     W1: ctrl= 0.001 (T-C)= 0.118  W2: ctrl= 0.016 (T-C)= 0.131
hora_semana(pep)                W1: ctrl= 3.873 (T-C)=-0.008  W2: ctrl= 3.922 (T-C)= 0.045
jeea_index_services(pep)        W1: ctrl= 0.000 (T-C)= 1.812  W2: ctrl= 0.007 (T-C)= 1.574
sisben(pep)                     W1: ctrl= 0.021 (T-C)= 0.541  W2: ctrl= 0.056 (T-C)= 0.573
subs(pep)                       W1: ctrl= 0.065 (T-C)= 0.311  W2: ctrl= 0.124 (T-C)= 0.376
bank(trt_hh)                    W1: ctrl= 0.030 (T-C)= 0.201  W2: ctrl= 0.055 (T-C)= 0.221
govtr(trt_hh)                   W1: ctrl= 0.065 (T-C)= 0.105  W2: ctrl= 0.019 (T-C)= 0.149
health_pca(pep)                 W1: ctrl=-0.060 (T-C)= 0.179  W2: ctrl= 0.052 (T-C)= 0.043
anx_depr(pep)                   W1: ctrl= 0.087 (T-C)=-0.057  W2: ctrl= 0.052 (T-C)=-0.024
index_food(pep)                 W1: ctrl=-0.023 (T-C)= 0.268  W2: ctrl=-0.012 (T-C)= 0.269
index_housing(pep)              W1: ctrl= 0.001 (T-C)= 0.069  W2: ctrl=-0.030 (T-C)= 0.077
index_integration(pep)          W1: ctrl=-0.017 (T-C)= 0.218  W2: ctrl=-0.006 (T-C)= 0.148
index_covid(pep)                W1: ctrl=-0.190 (T-C)= 0.235  W2: ctrl=-0.080 (T-C)= 0.169
index_remit(trt_hh)             W1: ctrl=-0.136 (T-C)= 0.128  W2: ctrl=-0.128 (T-C)= 0.044
index_fin_access(pep)           W1: ctrl=-0.044 (T-C)= 0.381  W2: ctrl=-0.058 (T-C)= 0.327
index_digital(pep)              W1: ctrl=-0.013 (T-C)= 0.088  W2: ctrl=-0.011 (T-C)= 0.083
index_discrim(pep)              W1: ctrl=-0.444 (T-C)= 0.019  W2: ctrl=-0.443 (T-C)= 0.023
r; t=0.37 12:49:17

. matrix `TD' = `TD'[2..., 1...]
r; t=0.00 12:49:17

. 
. /*==============================================================================
>   LAYER 6 — HISTOGRAMS (one PNG per outcome)
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:49:17

. di "--- Layer 6: generating histograms ---"
--- Layer 6: generating histograms ---
r; t=0.00 12:49:17

. 
. local n_hist = 0
r; t=0.00 12:49:17

. foreach g of local groups {
  2.     local vars : copy local `g'
  3.     foreach v of local vars {
  4.         capture confirm numeric variable `v'
  5.         if _rc continue
  6.         qui sum `v'
  7.         if r(N) == 0 continue
  8. 
.         capture {
  9.             qui inspect `v'
 10.             local nuniq = r(N_unique)
 11.             if `nuniq' <= 12 {
 12.                 graph bar (count), over(`v', label(angle(45) labsize(*.7))) ///
>                     by(wave_num, title("`v'", size(small)) note("", size(zero))) ///
>                     ytitle("Frequency") name(g_`v', replace)
 13.             }
 14.             else {
 15.                 histogram `v', percent ///
>                     by(wave_num, title("`v'", size(small)) note("", size(zero))) ///
>                     name(g_`v', replace)
 16.             }
 17.             graph export "$figs/hist_`v'.png", replace width(800)
 18.             graph drop g_`v'
 19.             local ++n_hist
 20.         }
 21.     }
 22. }
r; t=305.84 12:54:23

. di "  Generated `n_hist' histograms."
  Generated 147 histograms.
r; t=0.00 12:54:23

. 
. /*==============================================================================
>   PDF REPORT
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:54:23

. di "--- Building PDF report ---"
--- Building PDF report ---
r; t=0.00 12:54:23

. 
. * Read the flag log we just wrote, into a working dataset
. preserve
r; t=0.05 12:54:23

. import delimited "$out/04_Descriptives_FlagLog.txt", clear delimiter(tab) ///
>     varnames(1) stringcols(_all)
(encoding automatically selected: ISO-8859-1)
(12 vars, 148 obs)
r; t=0.28 12:54:23

. tempfile flagdata
r; t=0.00 12:54:23

. save `flagdata'
file C:\Users\wb614536\AppData\Local\Temp\ST_7cc4_000002.tmp saved as .dta format
r; t=0.00 12:54:23

. restore
r; t=0.01 12:54:23

. 
. putpdf clear
r; t=0.05 12:54:23

. putpdf begin, pagesize(letter) margin(left, 0.7in) margin(right, 0.7in)
r; t=0.03 12:54:23

. 
. putpdf paragraph, halign(center)
r; t=0.03 12:54:23

. putpdf text ("Outcome Verification Report"), bold font(, 16)
r; t=0.01 12:54:23

. putpdf paragraph, halign(center)
r; t=0.01 12:54:23

. putpdf text ("Six-layer diagnostic on PEP_Analysis_Sample.dta — Wave 1 (2020) and Wave 2 (2021). $S_DATE."), itali
> c
r; t=0.00 12:54:23

. 
. putpdf paragraph
r; t=0.03 12:54:23

. putpdf text ("Overview. "), bold
r; t=0.00 12:54:23

. putpdf text ("Each constructed outcome is checked on six dimensions before entering the RD analysis: (L1) range an
> d type are inside the labeled domain, (L2) coverage is reasonable in each wave, (L3) related items satisfy logical
>  consistency (e.g., went-without-food implies skipped-meals), (L4) predetermined controls are stable across waves,
>  (L5) the treatment-control mean difference is in the expected direction, and (L6) the marginal distribution looks
>  sensible. Outcomes are organized into the same thematic groups used downstream in the RD coefficient plots and ta
> bles. '(SD)' denotes standardized indices (mean 0, SD 1 in the within-wave control group); '[=1]' denotes binary i
> ndicators (so the mean is the share of households / individuals with that attribute).")
r; t=0.00 12:54:23

. 
. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("Headline counts"), bold font(, 13)
r; t=0.00 12:54:23

. putpdf table hc = (5, 2), border(all)
r; t=0.02 12:54:23

. putpdf table hc(1,1) = ("Status"), bold
r; t=0.01 12:54:23

. putpdf table hc(1,2) = ("Count"), bold
r; t=0.00 12:54:23

. putpdf table hc(2,1) = ("Outcomes summarized")
r; t=0.00 12:54:23

. putpdf table hc(2,2) = ("`n_present'")
r; t=0.00 12:54:23

. putpdf table hc(3,1) = ("Outcomes absent")
r; t=0.00 12:54:23

. putpdf table hc(3,2) = ("`n_absent'")
r; t=0.00 12:54:23

. putpdf table hc(4,1) = ("Outcomes string/empty (skipped)")
r; t=0.00 12:54:23

. putpdf table hc(4,2) = ("`n_empty'")
r; t=0.00 12:54:23

. putpdf table hc(5,1) = ("Outcomes with at least one flag")
r; t=0.00 12:54:23

. putpdf table hc(5,2) = ("`n_flagged'")
r; t=0.00 12:54:23

. 
. * RED-FLAG TABLE: outcomes with non-empty flag
. putpdf paragraph
r; t=0.01 12:54:23

. putpdf text ("Red-flag table"), bold font(, 13)
r; t=0.00 12:54:23

. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("Outcomes that failed at least one Layer 1-2 check."), italic font(, 10)
r; t=0.00 12:54:23

. 
. preserve
r; t=0.04 12:54:23

. use `flagdata', clear
r; t=0.00 12:54:23

. keep if flags != "" & flags != "absent" & flags != "empty" & flags != "skip"
(147 observations deleted)
r; t=0.00 12:54:23

. local nflag = _N
r; t=0.00 12:54:23

. if `nflag' > 0 {
.     putpdf table rf = (`=`nflag'+1', 4), border(all)
r; t=0.00 12:54:23
.     putpdf table rf(1,1) = ("Group"), bold halign(center)
r; t=0.00 12:54:23
.     putpdf table rf(1,2) = ("Variable"), bold halign(center)
r; t=0.00 12:54:23
.     putpdf table rf(1,3) = ("Type"), bold halign(center)
r; t=0.00 12:54:23
.     putpdf table rf(1,4) = ("Flag"), bold halign(center)
r; t=0.00 12:54:23
.     forvalues i = 1/`nflag' {
  2.         local rownum = `i' + 1
  3.         local rawnm  = variable[`i']
  4.         local pretty "`lbl_`rawnm''"
  5.         if "`pretty'" == "" local pretty "`rawnm'"
  6.         putpdf table rf(`rownum',1) = ("`=group[`i']'")
  7.         putpdf table rf(`rownum',2) = ("`pretty'"),  font(, 9)
  8.         putpdf table rf(`rownum',3) = ("`=type[`i']'")
  9.         putpdf table rf(`rownum',4) = ("`=flags[`i']'"), font("Courier", 9)
 10.     }
r; t=0.01 12:54:23
.     putpdf paragraph
r; t=0.00 12:54:23
.     putpdf text ("Notes: Flags are short codes describing the failed check (e.g., 'oor' = out of labeled range, 'l
> ow_N' = fewer than 100 non-missing observations, 'monotone' = labeled-as-monotonic series fails monotonicity). Var
> iable names use the polished outcome labels."), italic font(, 9)
r; t=0.00 12:54:23
. }
r; t=0.02 12:54:23

. else {
.     putpdf paragraph
r; t=0.00 12:54:23
.     putpdf text ("No outcomes failed Layer 1-2 checks."), italic
r; t=0.00 12:54:23
. }
r; t=0.00 12:54:23

. restore
r; t=0.01 12:54:23

. 
. * Layer 3 internal consistency
. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("Layer 3 — internal consistency"), bold font(, 13)
r; t=0.00 12:54:23

. local n_ic : word count `ic_names'
r; t=0.00 12:54:23

. if `n_ic' > 0 {
.     putpdf table ic = (`=`n_ic'+1', 2), border(all)
r; t=0.00 12:54:23
.     putpdf table ic(1,1) = ("Check"), bold halign(center)
r; t=0.00 12:54:23
.     putpdf table ic(1,2) = ("Mismatches"), bold halign(center)
r; t=0.00 12:54:23
.     forvalues i = 1/`n_ic' {
  2.         local nm  : word `i' of `ic_names'
  3.         local val : word `i' of `ic_values'
  4.         putpdf table ic(`=`i'+1',1) = ("`nm'"), font("Courier", 9)
  5.         putpdf table ic(`=`i'+1',2) = ("`val'")
  6.     }
r; t=0.01 12:54:23
. }
r; t=0.01 12:54:23

. 
. * Layer 4 cross-wave predetermined-control stability
. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("Layer 4 — predetermined controls across waves"), bold font(, 13)
r; t=0.00 12:54:23

. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("Time-invariant controls should have similar means in W1/W2."), italic font(, 10)
r; t=0.00 12:54:23

. putpdf paragraph
r; t=0.00 12:54:23

. putpdf text ("(Detailed table in 04_Descriptives_log.txt — putpdf size limits)"), italic font(, 9)
r; t=0.00 12:54:23

. 
. * Layer 5 treatment differences and per-group histograms moved to a SECOND
. * PDF below — putpdf hits an internal state limit when too many tables are
. * added to a single document.
. putpdf save "$out/04_Descriptives_part1.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part1.pdf"
r; t=0.03 12:54:24

. 
. * ── PART 2: Layer 5 + per-group breakdown ──
. putpdf clear
r; t=0.00 12:54:24

. putpdf begin, pagesize(letter) margin(left, 0.7in) margin(right, 0.7in)
r; t=0.00 12:54:24

. putpdf paragraph, halign(center)
r; t=0.00 12:54:24

. putpdf text ("Outcome Verification — Part 2"), bold font(, 16)
r; t=0.00 12:54:24

. putpdf paragraph, halign(center)
r; t=0.03 12:54:24

. putpdf text ("Treatment differences and per-group breakdown."), italic
r; t=0.00 12:54:24

. 
. putpdf paragraph
r; t=0.00 12:54:24

. putpdf text ("Layer 5 — Treatment differences (headline outcomes)"), bold font(, 13)
r; t=0.00 12:54:24

. putpdf paragraph
r; t=0.00 12:54:24

. putpdf text ("Raw control-group mean and unadjusted treatment-control difference, by wave. The treatment indicator
>  is the JEEA-style PEP eligibility (date >= 0 after reflection); these are not RD estimates and contain no control
> s. Use them as a sanity check that the program-eligible group differs in the expected direction."), italic font(, 
> 10)
r; t=0.00 12:54:24

. 
. local n_td = rowsof(`TD')
r; t=0.00 12:54:24

. putpdf table td = (`=`n_td'+1', 5), border(all)
r; t=0.00 12:54:24

. putpdf table td(1,1) = ("Outcome"), bold halign(center)
r; t=0.00 12:54:24

. putpdf table td(1,2) = ("W1 ctrl mean"), bold halign(center)
r; t=0.00 12:54:24

. putpdf table td(1,3) = ("W1 (T-C)"), bold halign(center)
r; t=0.00 12:54:24

. putpdf table td(1,4) = ("W2 ctrl mean"), bold halign(center)
r; t=0.00 12:54:24

. putpdf table td(1,5) = ("W2 (T-C)"), bold halign(center)
r; t=0.00 12:54:24

. forvalues i = 1/`n_td' {
  2.     local nm     : word `i' of `td_names'
  3.     local pretty "`lbl_`nm''"
  4.     if "`pretty'" == "" local pretty "`nm'"
  5.     local rownum = `i' + 1
  6.     putpdf table td(`rownum',1) = ("`pretty'"), font(, 9)
  7.     putpdf table td(`rownum',2) = ("`=string(`TD'[`i',1], "%6.3f")'")
  8.     putpdf table td(`rownum',3) = ("`=string(`TD'[`i',2], "%6.3f")'")
  9.     putpdf table td(`rownum',4) = ("`=string(`TD'[`i',3], "%6.3f")'")
 10.     putpdf table td(`rownum',5) = ("`=string(`TD'[`i',4], "%6.3f")'")
 11. }
r; t=0.05 12:54:24

. 
. putpdf save "$out/04_Descriptives_part2.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part2.pdf"
r; t=0.02 12:54:24

. 
. * ── PART 3: Per-group summary tables (one PDF per 4 groups to stay under
. *    putpdf table-count limits) ──
. local part3_count = 0
r; t=0.00 12:54:24

. local groups_in_doc = 0
r; t=0.00 12:54:24

. foreach g of local groups {
  2.     if `groups_in_doc' == 0 {
  3.         local ++part3_count
  4.         putpdf clear
  5.         putpdf begin, pagesize(letter) margin(left, 0.6in) margin(right, 0.6in)
  6.         putpdf paragraph, halign(center)
  7.         putpdf text ("Outcome Verification — Part `=`part3_count'+2'"), bold font(, 16)
  8.     }
  9.     local ++groups_in_doc
 10. 
.     putpdf paragraph
 11.     putpdf paragraph
 12.     putpdf text ("Group `g' — `title_`g''"), bold font(, 14)
 13. 
.     preserve
 14.     use `flagdata', clear
 15.     keep if group == "`g'"
 16.     local nrows = _N
 17.     if `nrows' > 0 {
 18.         putpdf table sg`g' = (`=`nrows'+1', 6), border(all)
 19.         putpdf table sg`g'(1,1) = ("Outcome"), bold halign(center)
 20.         putpdf table sg`g'(1,2) = ("Type"), bold halign(center)
 21.         putpdf table sg`g'(1,3) = ("N (W1 / W2)"), bold halign(center)
 22.         putpdf table sg`g'(1,4) = ("Mean (W1 / W2)"), bold halign(center)
 23.         putpdf table sg`g'(1,5) = ("Range"), bold halign(center)
 24.         putpdf table sg`g'(1,6) = ("Flags"), bold halign(center)
 25.         forvalues i = 1/`nrows' {
 26.             local rownum = `i' + 1
 27.             local rawnm  = variable[`i']
 28.             local pretty "`lbl_`rawnm''"
 29.             if "`pretty'" == "" local pretty "`rawnm'"
 30.             putpdf table sg`g'(`rownum',1) = ("`pretty'"), font(, 8)
 31.             putpdf table sg`g'(`rownum',2) = ("`=type[`i']'"), font(, 8)
 32.             putpdf table sg`g'(`rownum',3) = ("`=n_w1[`i']' / `=n_w2[`i']'"), halign(center) font(, 8)
 33.             putpdf table sg`g'(`rownum',4) = ("`=mean_w1[`i']' / `=mean_w2[`i']'"), halign(center) font(, 8)
 34.             putpdf table sg`g'(`rownum',5) = ("`=min[`i']' to `=max[`i']'"), halign(center) font(, 8)
 35.             putpdf table sg`g'(`rownum',6) = ("`=flags[`i']'"), halign(center) font("Courier", 7)
 36.         }
 37.     }
 38.     restore
 39. 
.     * Save and start a new PDF every 4 groups
.     if `groups_in_doc' >= 4 {
 40.         putpdf save "$out/04_Descriptives_part`=`part3_count'+2'.pdf", replace
 41.         local groups_in_doc = 0
 42.     }
 43. }
(142 observations deleted)
(140 observations deleted)
(137 observations deleted)
(138 observations deleted)
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part3.pdf"
(141 observations deleted)
(138 observations deleted)
(136 observations deleted)
(142 observations deleted)
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part4.pdf"
(135 observations deleted)
(140 observations deleted)
(141 observations deleted)
(137 observations deleted)
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part5.pdf"
(140 observations deleted)
(140 observations deleted)
(139 observations deleted)
(134 observations deleted)
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/04_Descriptives_part6.pdf"
r; t=1.75 12:54:25

. * Save the final partial PDF if any groups remain
. if `groups_in_doc' > 0 {
.     putpdf save "$out/04_Descriptives_part`=`part3_count'+2'.pdf", replace
r; t=0.00 12:54:25
. }
r; t=0.00 12:54:25

. 
. * For backward-compat, also produce a renamed primary file
. copy "$out/04_Descriptives_part1.pdf" "$out/04_Descriptives.pdf", replace
(file ../outputs/04_Descriptives.pdf not found)
r; t=0.01 12:54:25

. 
. * LaTeX skeleton (links to inventory text)
. file open tex using "$out/04_Descriptives.tex", write replace
(file ../outputs/04_Descriptives.tex not found)
r; t=0.00 12:54:25

. file write tex "\documentclass[11pt]{article}\usepackage[margin=1in]{geometry}\usepackage{booktabs}" _n
r; t=0.00 12:54:25

. file write tex "\title{Outcome Verification Report}\author{Sandra Rozo}\date{\today}\begin{document}\maketitle" _n
r; t=0.00 12:54:25

. file write tex "\begin{tabular}{lr}\toprule" _n
r; t=0.00 12:54:25

. file write tex "Outcomes summarized & `n_present' \\" _n
r; t=0.00 12:54:25

. file write tex "Outcomes absent & `n_absent' \\" _n
r; t=0.00 12:54:25

. file write tex "Outcomes string/empty & `n_empty' \\" _n
r; t=0.00 12:54:25

. file write tex "Outcomes flagged & `n_flagged' \\\bottomrule\end{tabular}" _n
r; t=0.00 12:54:25

. file write tex "\par See \texttt{04\_Descriptives.pdf} for the per-group breakdown." _n
r; t=0.00 12:54:25

. file write tex "\par See \texttt{04\_Descriptives\_FlagLog.txt} for machine-readable details." _n
r; t=0.00 12:54:25

. file write tex "\end{document}" _n
r; t=0.00 12:54:25

. file close tex
r; t=0.00 12:54:25

. 
. di ""

r; t=0.00 12:54:25

. di "  PDF saved:    $out/04_Descriptives.pdf"
  PDF saved:    ../outputs/04_Descriptives.pdf
r; t=0.00 12:54:25

. di "  TeX saved:    $out/04_Descriptives.tex"
  TeX saved:    ../outputs/04_Descriptives.tex
r; t=0.00 12:54:25

. di "  Flag log:     $out/04_Descriptives_FlagLog.txt"
  Flag log:     ../outputs/04_Descriptives_FlagLog.txt
r; t=0.00 12:54:25

. di "  Histograms:   $figs/ (`n_hist' files)"
  Histograms:   ../outputs/figures/ (147 files)
r; t=0.00 12:54:25

. di "  Done."
  Done.
r; t=0.00 12:54:25

. 
. log close
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/04_Descriptives_log.txt
  log type:  text
 closed on:  25 Jun 2026, 12:54:25
--------------------------------------------------------------------------------------------------------------------
